//
//  SheZhiViewController.m
//  XingRun
//
//  Created by 赵颜彬 on 17/1/13.
//  Copyright © 2017年 赵颜彬. All rights reserved.
//

#import "SheZhiViewController.h"

@interface SheZhiViewController ()<UITableViewDataSource, UITableViewDelegate>

@property (nonatomic, strong) UITableView *tableView;

@property (nonatomic, strong) NSArray *dataArr;

@property (nonatomic, strong) UIView *uv;

@end

@implementation SheZhiViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
    
    self.view.backgroundColor = [UIColor whiteColor];
    
    self.navigationItem.title = @"设置";
    
    self.dataArr = @[@"账号绑定",@"手机号",@"微信",@"QQ",@"微博",@"其他",@"修改密码",@"信息推送",@"检查更新"];
    
    [self cretableView];
}
-(void)cretableView{
    self.tableView = [[UITableView alloc] initWithFrame:CGRectMake(0, -29, self.view.bounds.size.width, self.view.bounds.size.height) style:UITableViewStyleGrouped];
    self.tableView.backgroundColor = [UIColor whiteColor];
        _tableView.tableFooterView = [[SheZhiView alloc]initWithFrame:CGRectMake(0, 0, self.view.bounds.size.width, 100 * HEIGHT)];
    [self.view addSubview:_tableView];
    
    _tableView.delegate = self;
    _tableView.dataSource = self;
    
    
}



-(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
    
    return _dataArr.count;
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
        UITableViewCell  *cell= [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:@"cell"];
    cell.selectionStyle=UITableViewCellSelectionStyleNone;//设置
    cell.textLabel.text = _dataArr[indexPath.row];
    cell.textLabel.font = [UIFont fontWithName:@"Helvetica" size:14];
    
    if (indexPath.row == 1 || indexPath.row == 3 || indexPath.row == 4) {
        UIButton *btn = [UIButton buttonWithType:UIButtonTypeCustom];
        btn.frame = CGRectMake(310 * WIDTH, 10 * HEIGHT, 60 * WIDTH, 30 * HEIGHT);
        [btn setTitle:@"绑定" forState:UIControlStateNormal];
        [btn setTitleColor:[UIColor blackColor]forState:UIControlStateNormal];
        btn.titleLabel.font = [UIFont systemFontOfSize: 12.0];

        [btn.layer setCornerRadius:10.0]; //设置矩形四个圆角半径
        [btn.layer setBorderWidth:0.5]; //边框宽度
        btn.layer.borderColor=[UIColor blackColor].CGColor;
        [cell addSubview:btn];
    }if (indexPath.row == 2) {
        UIButton *btn = [UIButton buttonWithType:UIButtonTypeCustom];
        btn.frame = CGRectMake(310 * WIDTH, 10 * HEIGHT, 60 * WIDTH, 30 * HEIGHT);
        [btn setTitle:@"解绑" forState:UIControlStateNormal];
        [btn setTitleColor:[UIColor blackColor]forState:UIControlStateNormal];
        btn.titleLabel.font = [UIFont systemFontOfSize: 12.0];
        [cell addSubview:btn];
    }if (indexPath.row == 6) {
        UIImageView *img = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"箭头"]];
        img.frame = CGRectMake(350 * WIDTH, 20 * HEIGHT, 8 * WIDTH, 16 * HEIGHT);
        [cell addSubview:img];
    }if (indexPath.row == 7) {
        UISwitch *kaiguan = [[UISwitch alloc]initWithFrame:CGRectMake(310 * WIDTH, 10 * HEIGHT, 60 * WIDTH, 30 * HEIGHT)];
        [cell addSubview:kaiguan];
    }if (indexPath.row == 8) {
        UILabel *lb = [[UILabel alloc] init];
        lb.frame = CGRectMake(280 *WIDTH, 10 *HEIGHT, 90 * WIDTH, 30 * HEIGHT);
        lb.text = @"当前版本1.0.1";
        lb.font = [UIFont fontWithName:@"Helvetica" size:12];
        [cell addSubview:lb];
    }

        return cell;

    
    
}
- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
{
    return 50 *HEIGHT;
}


- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
